use std::sync::mpsc;
use std::thread;

fn main() {
    //创建一个通道
    let (sender, receiver) = mpsc::channel();
    //启动一个生产者
    thread::spawn(move || {
        let message = "Hello from the producer!";
        sender.send(message).expect("Failed to send message");
    });
    //接收生产者的消息
    let received_message = receiver.recv().expect("Failed to receive message");
    println!("Received message: {}", received_message);
}
